#define _CRT_SECURE_NO_WARNINGS 1

#include "SList.h"

void TestSList1()
{
	SLTNode* plist = NULL;
	//SLPushFront(plist, 1);
	SLPushFront(&plist, 1);
	SLPushFront(&plist, 2);
	SLPushFront(&plist, 3);
	SLPushFront(&plist, 4);

	SLTPrint(plist);
}

void TestSList2()
{
	SLTNode* plist = NULL;
	//SLPushFront(plist, 1);
	SLPushFront(&plist, 1);
	SLPushFront(&plist, 2);
	SLPushFront(&plist, 3);
	SLPushFront(&plist, 4);

	/*SLPushBack(plist, 1);
	SLPushBack(plist, 1);*/

	SLTPrint(plist);
}

void TestSList3()
{
	SLTNode* plist = NULL;

	/*SLPushBack(plist, 1);
	SLPushBack(plist, 1);*/

	SLTPrint(plist);
}

void TestSList4()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLTPrint(plist);
}

void TestSList5()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPushBack(&plist, 5);
	SLPopFront(&plist);
	SLPopFront(&plist);
	SLTPrint(plist);
	SLPopFront(&plist);
	SLPopFront(&plist);
	SLTPrint(plist);
	SLPopFront(&plist);
	//SLPopFront(&plist);
	SLTPrint(plist);
}

void TestSList6()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPushBack(&plist, 5);
	SLPopBack(&plist);
	SLPopBack(&plist);
	SLTPrint(plist);
	SLPopBack(&plist);
	SLPopBack(&plist);
	SLTPrint(plist);
	SLPopBack(&plist);
	//SLPopFront(&plist);
	SLTPrint(plist);
}

void TestSList7()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPushBack(&plist, 5);
	SLTNode* pos = SLFind(plist, 2);
	if (pos != NULL)
	{
		SLInsert(&plist, pos, 20);
	}
	SLTPrint(plist);
}

void TestSList8()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPushBack(&plist, 5);
	SLTNode* pos = SLFind(plist, 3);
	if (pos != NULL)
	{
		SLInsertAfter(pos, 30);
	}
	SLTPrint(plist);
}

void TestSList9()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPushBack(&plist, 5);
	SLTNode* pos = SLFind(plist, 3);
	if (pos != NULL)
	{
		SLErase(&plist, pos);
	}
	SLTPrint(plist);
}

void TestSList10()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPushBack(&plist, 5);
	SLTNode* pos = SLFind(plist, 3);
	if (pos != NULL)
	{
		SLEraseAfter(pos);
	}
	SLTPrint(plist);
}

void TestSList11()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPushBack(&plist, 5);
	SLTNode* pos = SLFind(plist, 3);
	if (pos != NULL)
	{
		SLEraseAfter(pos);
	}
	SLTPrint(plist);

	SLDestroy(&plist);
}

void TestSList12()
{
	SLTNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 2);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 4);
	SLPushBack(&plist, 5);
	SLTNode* pos = SLFind(plist, 3);
	if (pos != NULL)
	{
		SLEraseAfter(pos);
	}
	SLTPrint(plist);

	SLDestroy(plist);
	plist = NULL;
}

int main()
{
	TestSList12();
	return 0;
}